extensibility

Document Building: Inserting Elements, Attributes, Processing Instructions, Comments, and Text


XML Instance provides graphical document building tools which facilitate the insertion of new elements, attributes, processing instructions, comments, and text.  The two main insertion tools are the insert drop-down box, which appears in the Tag area, and the Factory bar which appears in between the Tag and Edit areas and the Errors pane.  

Insert drop-down box  

Within the Tag area, double click on an element (or press Ctrl+Enter) to generate a drop down box (Figure A). This box will always contain an empty box with a series of icons below which, when selected, determine the type (element, attribute, etc.) and location (child, sibling, parent) of the node to be entered. (The insertion default is an element sibling.)  If the document is based on a schema, any elements and attributes available based on the schema's content models will also be appear in the insert drop down box, and can be added with single mouse click.  Note in Figure A that the elements appearing the drop down box are marked by various indentions which represent their relationship to the selected element.  In this case, street and city are siblings to the selected element, street, and hence, appear along the same vertical line.  The elements shipTo and item appear to the left of the selected item, indicating parent and grand-parent relationships, respectively. 

 

Figure A. Insert drop down box

In Figure A, a name for a new sibling element for street has been entered into the text box. With a single click on the appropriate icon, this new entry can be changed from an element into an attribute, text, comment, or processing instruction. When you are finished entering and defining your new tags, either hit tab or enter to complete the entry.

Note: If you are using a schema to build your document, adding new elements and attributes may cause your document to become invalid.  XML Instance allows you to create documents that break from the structure of your schema, but will alert you whenever this occurs via the Errors Pane.

 

The Factory Bar

When opened via the View Menu (View...Factory Bar), the Factory Bar is visible below the Tag and Edit areas and just above the Errors pane. 

Figure B- The Factory Bar

The Factory Bar provides an easy way to identify and insert any additional elements (children or siblings) or attributes defined by the schema for the element selected in the Tag area.  Click on any element of attribute appearing on the Factory bar to have it automatically added to the document.  The Factory bar also facilitates the insertion of new elements and attributes, as well as new comments, processing instructions, and text.  Figure C depicts the insert box which appears after clicking on the comment icon on the Factory bar. 

 

  

Figure C - Adding a new comment

 

Copyright 2000 Extensibility, Inc.

Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516